package com.sh.sales.happysales.datautils;

import com.sh.polymedicine.happysale.net.entity.UserToken;

import org.litepal.crud.DataSupport;

import java.util.List;

/**
 * Created by zhouyucheng on 2017/9/20.
 */

public class LocalTokenUtils {
    public static boolean insertUserToken(UserToken mUserToken) {
      return   mUserToken.save();
//        try {
//            mUserToken.saveThrows();
//        } catch (Exception e) {
//            Log.i("LocalTokenUtils", "insertUserToken: "+e);
//            e.printStackTrace();
//        }
    }

    public static int deleteUserToken(String tokenId) {
        return DataSupport.deleteAll(UserToken.class, "tokenId = ? ", tokenId + "");
    }

    public static int updataUserToken(UserToken mUserToken, String tokenId) {
        return mUserToken.updateAll("tokenId=? ", tokenId);
    }

    public static UserToken queryFirst() {
        return DataSupport.findFirst(UserToken.class);
    }

    public static List<UserToken> queryALL() {
        return DataSupport.findAll(UserToken.class);
    }

}
